$ () ->
	$("#update_btn").click (e) ->
		param=
			id:$("#user_id").val()
			username:$("#username").val()
			password:$("#password").val()
			last_name:$("#last_name").val()
			first_name:$("#first_name").val()
			role_id:$("#role_id").val()

		$.post "/api/admin/user/update-user",param,(res) ->
			if res.status.errCode is 0
				alert "修改成功"
				window.location.href = '/admin/user/index'
			else
				alert res.status.message

	$("#cancel_btn").click (e) ->
		window.location.href = "/admin/user/index"

